home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / src / cblas / test_hpr2.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-18  |  4.9 KB  |  188 lines

  1. #include <gsl/gsl_test.h>
  2. #include <gsl/gsl_ieee_utils.h>
  3. #include <gsl/gsl_math.h>
  4. #include <gsl/gsl_cblas.h>
  5.  
  6. #include "tests.h"
  7.  
  8. void
  9. test_hpr2 (void) {
  10. const double flteps = 1e-4, dbleps = 1e-6;
  11.   {
  12.    int order = 101;
  13.    int uplo = 121;
  14.    int N = 1;
  15.    float alpha[2] = {-1.0f, 0.0f};
  16.    float Ap[] = { 0.159f, -0.13f };
  17.    float X[] = { 0.854f, 0.851f };
  18.    int incX = -1;
  19.    float Y[] = { 0.526f, -0.267f };
  20.    int incY = -1;
  21.    float Ap_expected[] = { -0.284974f, 0.0f };
  22.    cblas_chpr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  23.    {
  24.      int i;
  25.      for (i = 0; i < 1; i++) {
  26.        gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr2(case 1458) real");
  27.        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr2(case 1458) imag");
  28.      };
  29.    };
  30.   };
  31.  
  32.  
  33.   {
  34.    int order = 101;
  35.    int uplo = 122;
  36.    int N = 1;
  37.    float alpha[2] = {-1.0f, 0.0f};
  38.    float Ap[] = { 0.159f, -0.13f };
  39.    float X[] = { 0.854f, 0.851f };
  40.    int incX = -1;
  41.    float Y[] = { 0.526f, -0.267f };
  42.    int incY = -1;
  43.    float Ap_expected[] = { -0.284974f, 0.0f };
  44.    cblas_chpr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  45.    {
  46.      int i;
  47.      for (i = 0; i < 1; i++) {
  48.        gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr2(case 1459) real");
  49.        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr2(case 1459) imag");
  50.      };
  51.    };
  52.   };
  53.  
  54.  
  55.   {
  56.    int order = 102;
  57.    int uplo = 121;
  58.    int N = 1;
  59.    float alpha[2] = {-1.0f, 0.0f};
  60.    float Ap[] = { 0.159f, -0.13f };
  61.    float X[] = { 0.854f, 0.851f };
  62.    int incX = -1;
  63.    float Y[] = { 0.526f, -0.267f };
  64.    int incY = -1;
  65.    float Ap_expected[] = { -0.284974f, 0.0f };
  66.    cblas_chpr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  67.    {
  68.      int i;
  69.      for (i = 0; i < 1; i++) {
  70.        gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr2(case 1460) real");
  71.        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr2(case 1460) imag");
  72.      };
  73.    };
  74.   };
  75.  
  76.  
  77.   {
  78.    int order = 102;
  79.    int uplo = 122;
  80.    int N = 1;
  81.    float alpha[2] = {-1.0f, 0.0f};
  82.    float Ap[] = { 0.159f, -0.13f };
  83.    float X[] = { 0.854f, 0.851f };
  84.    int incX = -1;
  85.    float Y[] = { 0.526f, -0.267f };
  86.    int incY = -1;
  87.    float Ap_expected[] = { -0.284974f, 0.0f };
  88.    cblas_chpr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  89.    {
  90.      int i;
  91.      for (i = 0; i < 1; i++) {
  92.        gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr2(case 1461) real");
  93.        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr2(case 1461) imag");
  94.      };
  95.    };
  96.   };
  97.  
  98.  
  99.   {
  100.    int order = 101;
  101.    int uplo = 121;
  102.    int N = 1;
  103.    double alpha[2] = {-0.3, 0.1};
  104.    double Ap[] = { 0.772, 0.997 };
  105.    double X[] = { -0.173, -0.839 };
  106.    int incX = -1;
  107.    double Y[] = { 0.941, -0.422 };
  108.    int incY = -1;
  109.    double Ap_expected[] = { 0.829742, 0.0 };
  110.    cblas_zhpr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  111.    {
  112.      int i;
  113.      for (i = 0; i < 1; i++) {
  114.        gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr2(case 1462) real");
  115.        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr2(case 1462) imag");
  116.      };
  117.    };
  118.   };
  119.  
  120.  
  121.   {
  122.    int order = 101;
  123.    int uplo = 122;
  124.    int N = 1;
  125.    double alpha[2] = {-0.3, 0.1};
  126.    double Ap[] = { 0.772, 0.997 };
  127.    double X[] = { -0.173, -0.839 };
  128.    int incX = -1;
  129.    double Y[] = { 0.941, -0.422 };
  130.    int incY = -1;
  131.    double Ap_expected[] = { 0.829742, 0.0 };
  132.    cblas_zhpr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  133.    {
  134.      int i;
  135.      for (i = 0; i < 1; i++) {
  136.        gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr2(case 1463) real");
  137.        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr2(case 1463) imag");
  138.      };
  139.    };
  140.   };
  141.  
  142.  
  143.   {
  144.    int order = 102;
  145.    int uplo = 121;
  146.    int N = 1;
  147.    double alpha[2] = {-0.3, 0.1};
  148.    double Ap[] = { 0.772, 0.997 };
  149.    double X[] = { -0.173, -0.839 };
  150.    int incX = -1;
  151.    double Y[] = { 0.941, -0.422 };
  152.    int incY = -1;
  153.    double Ap_expected[] = { 0.829742, 0.0 };
  154.    cblas_zhpr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  155.    {
  156.      int i;
  157.      for (i = 0; i < 1; i++) {
  158.        gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr2(case 1464) real");
  159.        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr2(case 1464) imag");
  160.      };
  161.    };
  162.   };
  163.  
  164.  
  165.   {
  166.    int order = 102;
  167.    int uplo = 122;
  168.    int N = 1;
  169.    double alpha[2] = {-0.3, 0.1};
  170.    double Ap[] = { 0.772, 0.997 };
  171.    double X[] = { -0.173, -0.839 };
  172.    int incX = -1;
  173.    double Y[] = { 0.941, -0.422 };
  174.    int incY = -1;
  175.    double Ap_expected[] = { 0.829742, 0.0 };
  176.    cblas_zhpr2(order, uplo, N, alpha, X, incX, Y, incY, Ap);
  177.    {
  178.      int i;
  179.      for (i = 0; i < 1; i++) {
  180.        gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr2(case 1465) real");
  181.        gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr2(case 1465) imag");
  182.      };
  183.    };
  184.   };
  185.  
  186.  
  187. }
  188.